import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import {JVxeTypes,JVxeColumn} from '/@/components/jeecg/JVxeTable/types'
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '工作内容',
    align:"center",
    dataIndex: 'gongzuoneirong'
   },
   {
    title: '质量要求',
    align:"center",
    dataIndex: 'zhiliangyaoqiu'
   },
   {
    title: '完成时间',
    align:"center",
    dataIndex: 'wanchengshijian',
    customRender:({text}) =>{
      text = !text ? "" : (text.length > 10 ? text.substr(0,10) : text);
      return text;
    },
   },
   {
    title: '责任主管',
    align:"center",
    dataIndex: 'zerenzhuguan_dictText'
   },
   {
    title: '主管部门',
    align:"center",
    dataIndex: 'zhuguanbumen'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '工作内容',
    field: 'gongzuoneirong',
    component: 'InputTextArea',
  },
  {
    label: '质量要求',
    field: 'zhiliangyaoqiu',
    component: 'InputTextArea',
  },
  {
    label: '完成时间',
    field: 'wanchengshijian',
    component: 'DatePicker',
    componentProps:{
      valueFormat: 'YYYY-MM-DD'
    },    
  },
  {
    label: '责任主管',
    field: 'zerenzhuguan',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"",
        type: "radio"
     },
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];
//子表单数据
//子表表格配置
export const yuedupeihebumenColumns: JVxeColumn[] = [
    {
      title: '配合部门',
      key: 'peihebumen',
      type: JVxeTypes.select,
      options:[],
      dictCode:"",
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '完成时间',
      key: 'wanchengshijian',
      type: JVxeTypes.date,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '协作内容',
      key: 'xiezuoneirong',
      type: JVxeTypes.textarea,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '质量要求',
      key: 'zhiliangyaoqiu',
      type: JVxeTypes.textarea,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
  ]


// 高级查询数据
export const superQuerySchema = {
  gongzuoneirong: {title: '工作内容',order: 0,view: 'textarea', type: 'string',},
  zhiliangyaoqiu: {title: '质量要求',order: 1,view: 'textarea', type: 'string',},
  wanchengshijian: {title: '完成时间',order: 2,view: 'date', type: 'string',},
  zerenzhuguan: {title: '责任主管',order: 3,view: 'radio', type: 'string',dictCode: '',},
  zhuguanbumen: {title: '主管部门',order: 4,view: 'text', type: 'string',},
  //子表高级查询
  yuedupeihebumen: {
    title: '配合部门表',
    view: 'table',
    fields: {
        peihebumen: {title: '配合部门',order: 0,view: 'radio', type: 'string',dictCode: '',},
        wanchengshijian: {title: '完成时间',order: 1,view: 'date', type: 'string',},
        xiezuoneirong: {title: '协作内容',order: 2,view: 'textarea', type: 'string',},
        zhiliangyaoqiu: {title: '质量要求',order: 3,view: 'textarea', type: 'string',},
    }
  },
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
// 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}